package com.insight.common.mq.subscribe.cmp;

import com.yomahub.liteflow.annotation.LiteflowCmpDefine;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yuanqiao.insight.common.util.common.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CacheConstant;
import org.jeecg.common.mq.RedisMq;
import org.jeecg.common.mq.RedisMqInit;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author JinPengDong
 * @date 2023/12/19
 */
@Slf4j
@LiteflowComponent
@LiteflowCmpDefine
public class CmpSubscribeFinal {

    @Autowired
    private RedisUtils redisUtils;

    @LiteflowMethod(LiteFlowMethodEnum.PROCESS)
    public void process(NodeComponent cmp) {
        RedisMq.atomicBoolean.set(true);
        redisUtils.hset(CacheConstant.SYS_STREAM_HEARTBEAT + "cache", RedisMqInit.getCONSUMER(), RedisMqInit.getGROUP(), 3900);
        redisUtils.set(CacheConstant.SYS_STREAM_HEARTBEAT + RedisMqInit.getCONSUMER(), RedisMqInit.getGROUP(), 3900);
        log.info("======已全部订阅RedisMq消息======");
    }

}
